package com.zsrt.java.day20161227.hb.demo01;

import java.util.Arrays;

import org.junit.Test;

public class Demo02 {
	
	@Test
	
	public void qianghaobao2(){
		
		int bl=10;
		double x[];
		x=new double[bl];
		double sum=0;
		for(int index=0;index<bl-1;index++){
			
			do{
				
				x[index]=Math.random();
				
			}while(x[index]>=1-sum);
			
			sum=sum+x[index];
			
		}
		x[bl-1]=1-sum;
		System.out.println("开抢1元红包...");
		System.out.println(bl+"个人分别抢到：（元）");
		System.out.println(Arrays.toString(x));
		 
	}

}
